package DBUtil;

import Tools.InfoFormat;

public class UserInfo {
	String id;
	int integer;
	int grade;
	/**
	 * 累计在线时间ms
	 */
	public long onlineTime;
	
	public UserInfo(String name, int integer, int grade,long onlineTime) {
		super();
		this.id = name;
		this.integer = integer;
		this.grade = grade;
		this.onlineTime = onlineTime;
	}

	public int getGrade() {
		return grade;
	}

	public int getInteger() {
		return integer;
	}

	public String getId() {
		return id;
	}

	public boolean setGrade(int grade) {
		if(this.grade!=grade){
			this.grade = grade;
			return true;
		}
		return false;
	}

	public void setInteger(int integer) {
		this.integer = integer;
	}

	public void setName(String name) {
		this.id = name;
	}

	public String getOnlineTimeStr() {
		return InfoFormat.formatTimeGB(onlineTime/1000);
	}

	public boolean upGrade() {
		if(grade<256){
			grade++;
			return true;
		}
		return false;
	}
}
